package com.jfinal.demo.controller;

import com.jfinal.aop.Before;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Controller;
import com.jfinal.demo.interceptor.InterceptorA;
import com.jfinal.demo.interceptor.ManagerInterceptor;
import com.jfinal.log.Logger;

/**
 * Title:
 * Description:
 *
 * @version 2.0
 * @author: Yung Fu(FUYUNGCN AT GMAIL DOT com)
 * @since: 14-9-21 上午10:59
 */
public class HelloController extends Controller {

    Logger logger = Logger.getLogger(this.getClass());

    /**
     * 使用ActionKey之后访问地址由以前的/hello/index修改为/index
     */
    @ActionKey("/index")
    @Before(InterceptorA.class)
    public void index() {
        logger.info("进入 index()...............");
        renderText("helloWorld!");
    }


    /**
     * 执行顺序：
     * GlobalInterceptor start --> InterceptorA start --> InterceptorB start -->
     * invoke() -->
     * InterceptorB stop --> InterceptorA stop --> GlobalInterceptor stop
     */
    @Before(ManagerInterceptor.class)
    public void interceptorTest() {

    }
}
